package com.jackeys.piaems.dao.impl;

import com.jackeys.piaems.dao.ImageDao;
import com.jackeys.piaems.dao.mapper.ImageMapper;
import com.jackeys.piaems.dto.ImageInfDto;
import com.jackeys.piaems.entity.Image;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName: ImageDaoImpl
 * @Description: 图片持久层实现类
 * @Author: Jackeys
 * @Date: 2021-06-28 16:16
 * @Version: 1.0
 */
@Repository
public class ImageDaoImpl implements ImageDao {

    @Autowired
    private ImageMapper imageMapper;
    /**
    * @Name: queryImageBySize
    * @Description: 分页查询图片，实现分页查询图片的功能
    * @Param: [start, size]
    * @return: java.util.List<com.jackeys.piaems.entity.Image>
    * @Author: Jackeys
    * @Date: 2021/6/28 16:19
    * @Version: 1.0
    */
    @Override
    public List<Image> queryImageBySize(Integer start, Integer size) {
        return imageMapper.queryImageBySize(start,size);
    }

    /**
    * @Name: selectCntImage
    * @Description: 查询数据库图片数量
    * @Param: []
    * @return: java.lang.Integer
    * @Author: Jackeys
    * @Date: 2021/6/28 16:17
    * @Version: 1.0
    */
    @Override
    public Integer selectCntImage() {
        return imageMapper.selectCntImage();
    }

    /**
    * @Name: insertImage
    * @Description: 插入图片，实现插入图片的功能
    * @Param: [image, date]
    * @return: java.lang.Boolean
    * @Author: Jackeys
    * @Date: 2021/6/28 16:21
    * @Version: 1.0
    */
    @Override
    public Boolean insertImage(String image, String date) {
        return imageMapper.insertImage(image,date);
    }

    /**
    * @Name: queryImageBySizeAndCondition
    * @Description: 按照条件分页查询图片信息，实现查询图片信息的功能
    * @Param: [start, size, condition]
    * @return: java.util.List<com.jackeys.piaems.entity.Image>
    * @Author: Jackeys
    * @Date: 2021/6/30 21:34
    * @Version: 1.0
    */
    @Override
    public List<Image> queryImageBySizeAndCondition(Integer start, Integer size, String condition) {
        return imageMapper.queryImageBySizeAndCondition(start,size,condition);
    }
    /**
    * @Name: selectCntImageByCondition
    * @Description: 实现分页查询图片信息的总数量
    * @Param: [condition]
    * @return: java.lang.Integer
    * @Author: Jackeys
    * @Date: 2021/6/30 21:34
    * @Version: 1.0
    */
    @Override
    public Integer selectCntImageByCondition(String condition) {
        return imageMapper.selectCntImageByCondition(condition);
    }

    /**
     * @Name: selectCntAndDate
     * @Description: 按照日期分组查询照片数量
     * @Param: []
     * @return: java.util.List<com.jackeys.piaems.dto.ImageInfDto>
     * @Author: Jackeys
     * @Date: 2021/6/30 21:35
     * @Version: 1.0
     */
    @Override
    public List<ImageInfDto> selectCntAndDate() {
        return imageMapper.selectCntAndDate();
    }
}
